#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
时间表界面的代码。
"""
import tkinter as tk, tkinter.ttk

class Timetable(tk.Frame):
    def __init__(self, master, manager, cfg):
        self.manager = manager
        self.cfg = cfg
        super().__init__(master, **cfg["self cfg"])
        self.init_main_frame()
    
    def init_main_frame(self):
        self.ViewFrame = vf = tk.PanedWindow(self)
        
        temp_frame_left = tk.Frame(vf)
        temp_frame_right= tk.Frame(vf)
        
        plc = self.cfg["PassedLabel cfg"]
        pbc = self.cfg["PassedViewBtn cfg"]
        self.PassedLabel = pl = tk.Label(temp_frame_left, **plc)
        self.PassedViewBtn = pb = tk.Button(temp_frame_left, **pbc)
        pl.pack(fill="both", expand=0, side="top")
        pb.pack(fill="both", expand=1, side="top")
        
        tlc = self.cfg["TodoLabel cfg"]
        tbc = self.cfg["TodoViewBtn cfg"]
        self.TodoLabel = tl = tk.Label(temp_frame_right, **tlc)
        self.TodoViewBtn = tb = tk.Button(temp_frame_right, **tbc)
        tl.pack(fill="both", expand=0, side="top")
        tb.pack(fill="both", expand=1, side="top")
        
        self.ViewFrame.add(temp_frame_left,#将小最小宽度设置为标签所需宽度。
                           minsize=pl.winfo_reqwidth())
        self.ViewFrame.add(temp_frame_right, minsize=tl.winfo_reqwidth())
        self.ViewFrame.pack(fill="both", expand=1)